package logic

import (
	"context"
	"errors"
	"smart-health-platforms/pkg"
	"user_srv/internal/dao"
	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type DeletedFaseLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDeletedFaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeletedFaseLogic {
	return &DeletedFaseLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 删除人脸
func (l *DeletedFaseLogic) DeletedFase(in *user.DeletedFaseRequest) (*user.DeletedFaseResponse, error) {
	if in.UserId <= 0 {
		pkg.Error("用户ID不能为空")
		return nil, errors.New("用户ID不能为空")
	}
	err := dao.DeletedFase(int(in.UserId), in.FaceId)
	if err != nil {
		pkg.Error("删除失败")
		return nil, err
	}
	return &user.DeletedFaseResponse{
		Msg: "删除成功",
	}, nil
}
